package com.spzx.product.api;

import com.spzx.common.core.constant.SecurityConstants;
import com.spzx.common.core.constant.ServiceNameConstants;
import com.spzx.common.core.domain.R;

import com.spzx.product.api.domain.ProductSkuVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;

/**
 * @Author 快点干早点散
 * @Create 2025/5/7 20:49
 * 所有OpenFenign使用注解@FenignClient ,被扫描产生代理对象,由代理对象使用RequstTemplate发起http请求
 * 1
 */
@FeignClient(
        value = ServiceNameConstants.PRODUCT_SERVICE,
        path = "/productSku", //业务接口基础URL地址
        fallbackFactory = com.spzx.product.api.factory.RemoteProductFallbackFactory.class ) //确保被IOC容器扫描注册对象
public interface RemoteProductService {
    @Operation(summary = "获取商品SKU详情")
    @GetMapping("/getProductSku/{skuId}")
    public R<ProductSkuVo> getProductSku(@Parameter(description = "skuId")
                                       @PathVariable("skuId") Long skuid, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}
